<template>
	<view class="commentsBox">
		<view class="commentsHead">
			<view class="commentsHeadLogo">
				<image :src="comments.author.avatar" mode="widthFix"></image>
			</view>
			<view class="commentsHeadInfo">
				<view class="commentator">
					{{comments.author.author_name}}
				</view>
				<view>{{comments.create_time | formatTime}}</view>
			</view>
		</view>
			<view class="commentsText">
				<view>
					{{comments.comment_content}}
				</view>
				
					<!-- 回复功能 -->
			<!-- 	<view class="comments-info">
					<view class="commentsBtn" @click="commentsReply(comments)">
						回复
					</view>
				</view>
				<view class="comments-reply" v-for="item in comments.reply" :key="item.comment_id">
					<comments-box :comments="item"></comments-box>
				</view> -->
			</view>
	</view>
</template>

<script>
	import {parseTime}from'@/utils/index.js'
	// 引用自己
	import commentsBox from '@/components/comments-box/comments-box.vue'
	export default {
		components:{
			commentsBox
		},
		props:{
			comments:{
				type:Object,
				default(){
					return{}
				}
			}
		},
		filters:{
			formatTime(time){
				return parseTime(time)
			}
		},
		name: "comments-box",
		data() {
			return {

			};
		},
		methods:{
			
			
		}
	}
</script>

<style lang="scss">
	.commentsBox {
		margin: 15px 0;

		.commentsHead {
			display: flex;
			.commentsHeadLogo {
				flex-shrink: 0;
				width: 30px;
				height: 30px;
				border-radius: 15px;
				overflow: hidden;
				image {
					width: 100%;
					height: 100%;
				}
			}
			.commentsHeadInfo {
				display: flex;
				flex-direction: column;
				padding-left: 15px;
				font-size: 12px;
				color: #999;
				line-height: 1;
				.commentator{
					margin-bottom: 10px;
					font-size: 12px;
					color: #333;
				}
			}
		}
		.commentsText {
			margin-top: 10px;
			font-size: 14px;
			color: #000;
			.comments-info{
				margin-top: 15px;
				display: flex;
				.commentsBtn{
					padding: 2px 10px;
					font-size: 12px;
					color: #999;
					border-radius: 20px;
					border: 1px #ccc solid;
				}
			}
			.comments-reply{
				display: flex;
				margin: 15px 0;
				padding: 0 10px;
				border: 1px #eee solid;
			}
		}
	}
</style>
